/**
 * <copyright>
 * </copyright>
 *

 */
package sk.scerbak.ucl.usecases.usecases.impl;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

import sk.scerbak.ucl.usecases.usecases.ActionStep;
import sk.scerbak.ucl.usecases.usecases.Goto;
import sk.scerbak.ucl.usecases.usecases.UsecasesPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Goto</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link sk.scerbak.ucl.usecases.usecases.impl.GotoImpl#getNextStep <em>Next Step</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class GotoImpl extends ActionImpl implements Goto
{
  /**
   * The cached value of the '{@link #getNextStep() <em>Next Step</em>}' reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getNextStep()
   * @generated
   * @ordered
   */
  protected ActionStep nextStep;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected GotoImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return UsecasesPackage.Literals.GOTO;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public ActionStep getNextStep()
  {
    if (nextStep != null && nextStep.eIsProxy())
    {
      InternalEObject oldNextStep = (InternalEObject)nextStep;
      nextStep = (ActionStep)eResolveProxy(oldNextStep);
      if (nextStep != oldNextStep)
      {
        if (eNotificationRequired())
          eNotify(new ENotificationImpl(this, Notification.RESOLVE, UsecasesPackage.GOTO__NEXT_STEP, oldNextStep, nextStep));
      }
    }
    return nextStep;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public ActionStep basicGetNextStep()
  {
    return nextStep;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setNextStep(ActionStep newNextStep)
  {
    ActionStep oldNextStep = nextStep;
    nextStep = newNextStep;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, UsecasesPackage.GOTO__NEXT_STEP, oldNextStep, nextStep));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case UsecasesPackage.GOTO__NEXT_STEP:
        if (resolve) return getNextStep();
        return basicGetNextStep();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case UsecasesPackage.GOTO__NEXT_STEP:
        setNextStep((ActionStep)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case UsecasesPackage.GOTO__NEXT_STEP:
        setNextStep((ActionStep)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case UsecasesPackage.GOTO__NEXT_STEP:
        return nextStep != null;
    }
    return super.eIsSet(featureID);
  }

} //GotoImpl
